From: Glenn Morris Date: Tue, 13 Mar 2012 17:56:31 +0000 (-0400) Subject: Small calendar-string-spread fix for bug#10978 X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~445 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=134c1c68d74132d675b19e0a1ba69fdb78252cd8;p=emacs.git Small calendar-string-spread fix for bug#10978 * lisp/calendar/calendar.el (calendar-string-spread): Handle non-unit-width characters a bit better. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 15a1da8857f..311779a128e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-13 Glenn Morris + + * calendar/calendar.el (calendar-string-spread): + Handle non-unit-width characters a bit better. (Bug#10978) + 2012-03-13 Leo Liu * vc/vc-hg.el (vc-hg-working-revision): Rework to work with both diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 0c351c6072f..b09167ea49b 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1756,8 +1756,8 @@ the STRINGS are just concatenated and the result truncated." (if (< (length strings) 2) (append (list "") strings (list "")) strings))) - (n (- length (length (apply 'concat strings)))) - (m (1- (length strings))) + (n (- length (string-width (apply 'concat strings)))) + (m (* (1- (length strings)) (char-width char))) (s (car strings)) (strings (cdr strings)) (i 0)) @@ -1766,7 +1766,7 @@ the STRINGS are just concatenated and the result truncated." (make-string (max 0 (/ (+ n i) m)) char) string) i (1+ i))) - (substring s 0 length))) + (truncate-string-to-width s length))) (defun calendar-update-mode-line () "Update the calendar mode line with the current date and date style."